package com.chenss.dragonser.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.chenss.dragonser.R;
import com.chenss.dragonser.base.BaseAdp;
import com.chenss.dragonser.model.RecordListModel;

import java.util.List;

public class RecordListAdapter extends BaseAdp<RecordListModel> {


	public RecordListAdapter(Context ctx, List<RecordListModel> list) {
		super(ctx, list, R.layout.item_money_record);
	}

	@Override
	public void Convert(final int position, View convertView) {
		// TODO Auto-generated method stub
// 1.+收入
// 2.-支出
		TextView tv_price = Get(convertView,R.id.tv_price);
		TextView tv_name = Get(convertView,R.id.tv_name);
		TextView tv_time = Get(convertView,R.id.tv_time);
		tv_name.setText(mDataList.get(position).getRemark());
		tv_time.setText(mDataList.get(position).getCtime());
		final int status=Integer.parseInt(mDataList.get(position).getType());
		switch (status){
			case 1:
				tv_price.setText("+￥"+mDataList.get(position).getFee());
				tv_price.setTextColor(ContextCompat.getColor(mContext,R.color.appColor));
				break;
			case 2:
				tv_price.setText("-￥"+mDataList.get(position).getFee());
				tv_price.setTextColor(ContextCompat.getColor(mContext,R.color.textRed));
				break;

		}

	} 
}
